$(document).ready(function() {
    $('a.celia').click(function() {
        $('div.character').contains('CELIA').find('a').empty().remove();
        $('div.character').contains('CELIA').next().hide().end().append(' <a href="#" class="expand">. . .</a>');
        expandNext();
        return false;
    });	    
});

$(document).ready(function() {
    var totaldialogs = $('div.dialog').length;
    $('#total-dialogs').html("Number of DIVs with class of dialog: " + totaldialogs);
    $('#bare-class').click(function() {
        var time = new Date()
        $('.dialog').hide();
        time = new Date() - time;
        $('#time-taken').html(time + ' milliseconds');
        return false;
    });
    $('#div-class').click(function() {
        var time = new Date()
        $('div.dialog').hide();
        time = new Date() - time; 
        $('#time-taken').html(time + ' milliseconds');
        return false;
    });
    $('#div-filter').click(function() {
        var time = new Date()
        $('div').filter('.dialog').hide();
        time = new Date() - time; 
        $('#time-taken').html(time + ' milliseconds');
        return false;
    });
});

function expandNext() {
    $('a.expand').click(function() {
        $(this).parent().next().show('slow').end().end().empty().remove();
        return false;
    });
}
 